package com.tianji.learning.controller;

import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.domain.vo.LearningRecordVo;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学习记录表 控制器
 * </p>
 *
 * @author xjs
 */
@Api(tags = "LearningRecord管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/learning-records")
public class LearningRecordController {

    private final ILearningRecordService learningRecordService;

    @PostMapping
    public void submitLearningRecod(@RequestBody LearningRecordFormDTO dto){
        learningRecordService.submitLearningRecord(dto);
    }

    @GetMapping("/course/{courseId}")
    public LearningRecordVo getLearnRecord(@PathVariable("courseId") Long courseId){
        return learningRecordService.getLearnRecord(courseId);
    }

}